#include "player.h"
#include <iostream>

Player::Player(const std::string& name, Piece piece) : name(name), piece(piece) {}

std::string Player::getName() const { return name; }
Piece Player::getPiece() const { return piece; }

HumanPlayer::HumanPlayer(const std::string& name, Piece piece) : Player(name, piece) {}

void HumanPlayer::makeMove(Board& board) {
    int x, y;
    while (true) {
        std::cout << name << "请输入落子位置 (行 列): ";
        std::cin >> x >> y;
        
        if (board.placePiece(x, y, piece)) {
            break;
        }
        std::cout << "无效位置，请重新输入！\n";
    }
}